package server;

import servlet.HttpServlet;
import servlet.Request;
import servlet.Response;
import util.HttpProtocolUtil;

import java.io.IOException;

public class LagouDemoServlet extends HttpServlet {
    @Override
    public void doGet(Request request, Response response) {
        String context = "<h1>CYKServlet GET Demo</h1>";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200(context.length()) + context);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {
        String context = "<h1>CYKServlet POST Demo</h1>";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200(context.length()) + context);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}
